<template>
	<view class="detail">
		<view class="allPrice">
			<text>合计:</text>
			<text>{{momenyFormat(allPrice)}}</text>
		</view>
		<view style="height: 60rpx;"></view>
		<uni-list>
			<uni-list-item v-for="item in data" :key="item.Id" :title="item.InventName"
				:note="'单价: '+momenyFormat(item.Price)+' × '+item.Quantity" :thumb="item.Picture" thumb-size="lg"
				:rightText="momenyFormat(item.Money)" />
		</uni-list>
	</view>
</template>

<script>
	import {
		momenyFormat
	} from '@/util/util.js'
	export default {
		data() {
			return {
				data: [],
				id: ''
			}
		},
		computed: {
			allPrice() {
				let num = 0
				this.data.forEach(item => num += Number(item.Money) || 0)
				return num
			}
		},
		onLoad(query) {
			this.id = query.id
			this.getDataList()
		},
		methods: {
			getDataList() {
				uni.showLoading()
				this.$http('post', '/BO/BIlling/GetTheData', {
					id: this.id
				}).then(res => {
					uni.hideLoading()
					if (!res.Success) return this.$api.msg(res.Msg)
					this.data = JSON.parse(res.Data.Content)
				})
			},
			momenyFormat(num) {
				return momenyFormat(num)
			}
		}
	}
</script>

<style scoped lang="scss">
	.detail {
		.allPrice {
			position: fixed;
			width: 100vw;
			top: 44px;
			/* #ifdef APP */
			top: 0;
			/* #endif */
			left: 0;
			background-color: #fff;
			box-sizing: border-box;
			height: 60rpx;
			line-height: 60rpx;
			font-size: 40rpx;
			font-weight: bold;
			padding: 0 20rpx;
			z-index: 20;
			display: flex;
			justify-content: space-between;
		}
	}
</style>